<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="itcast" uri="http://itcast.cn/common/"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />

<title>卷筒分切任务表</title>
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet"
	media="screen" />
<link href="<%=basePath%>css/bootstrap-datetimepicker.min.css"
	rel="stylesheet" media="screen" />
<!-- Bootstrap Core CSS -->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet" />

<!-- MetisMenu CSS -->
<link href="<%=basePath%>css/metisMenu.min.css" rel="stylesheet" />

<!-- DataTables CSS -->
<link href="<%=basePath%>css/dataTables.bootstrap.css" rel="stylesheet" />

<!-- Custom CSS -->
<link href="<%=basePath%>css/sb-admin-2.css" rel="stylesheet" />

<!-- Custom Fonts -->
<link href="<%=basePath%>css/font-awesome.min.css" rel="stylesheet"
	type="text/css" />
<link href="<%=basePath%>css/boot-crm.css" rel="stylesheet"
	type="text/css" />

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

	<div id="wrapper">

		<!-- Navigation -->
		<nav class="navbar navbar-default navbar-static-top" role="navigation"
			style="margin-bottom: 0">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse"
				data-target=".navbar-collapse">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="<%=basePath%>index.action">工单管理系统V1.0</a>
			<div class="navbar-brand">欢迎您：${sessionScope.user_login.username}</div>
		</div>
		<!-- /.navbar-header --> <!-- /.navbar-top-links -->

		<div class="navbar-default sidebar panel-collapse collapse in"
			role="navigation">
			<div class="sidebar-nav navbar-collapse">
				<ul class="nav" id="side-menu">
					<li><a href="#WorkOrderSetting"
						class="sidebar-nav navbar-collapse" data-toggle="collapse">&nbsp;&nbsp;
							<i class="fa fa-th-list fa-fw"></i> 工单管理
					</a></li>
					<ul id="WorkOrderSetting" class="nav nav-list collapse secondmenu">
						<!-- <li><a href="<%=basePath%>createWorkOrder.action">&nbsp;&nbsp;<i class="fa fa-edit fa-fw"></i> 新建工单</a></li> -->
						<li><a href="<%=basePath%>queryWorkOrder.action">&nbsp;&nbsp;<i
								class="fa fa-eye fa-fw"></i> 查询工单
						</a></li>
						<li><a href="<%=basePath%>addMissionOrder.action">&nbsp;&nbsp;<i
								class="fa fa-plus fa-fw"></i> 新建任务
						</a></li>
						<li><a href="<%=basePath%>queryMissionOrder.action">&nbsp;&nbsp;<i
								class="fa fa-folder-open fa-fw"></i> 查询任务
						</a></li>
						<li><a href="<%=basePath%>statistics.action">&nbsp;&nbsp;<i class="fa fa-line-chart fa-fw"></i> 统计数据</a></li>
					</ul>
					<li><a href="#customerSetting"
						class="sidebar-nav navbar-collapse" data-toggle="collapse">&nbsp;&nbsp;
							<i class="fa fa-user fa-fw"></i> 员工管理
					</a></li>
					<ul id="customerSetting" class="nav nav-list collapse secondmenu">
						<li><a href="<%=basePath%>register.action">&nbsp;&nbsp;<i
								class="fa fa-plus fa-fw"></i> 创建员工
						</a></li>
						<li><a href="<%=basePath%>queryUser.action">&nbsp;&nbsp;<i
								class="fa fa-edit fa-fw"></i> 查询员工
						</a></li>
						<!-- <li><a href="#">&nbsp;&nbsp;<i class="fa fa-edit fa-fw"></i> 密码修改</a></li> -->
					</ul>
					<li><a href="#quit" class="sidebar-nav navbar-collapse"
						data-toggle="collapse">&nbsp;&nbsp;&nbsp;<i
							class="fa fa-remove fa-fw"></i> 账号登出
					</a></li>
					<ul id="quit" class="nav nav-list collapse secondmenu">
						<li><a href="<%=basePath%>quit.action">&nbsp;&nbsp;<i
								class="fa fa-remove fa-fw"></i> 退出
						</a></li>
					</ul>

				</ul>
			</div>
			<!-- /.sidebar-collapse -->
		</div>
		<!-- /.navbar-static-side --> </nav>

		<div id="page-wrapper">
			<div class="row">
				<div class="col-lg-12">
					<h1 class="page-header">卷筒分切任务表</h1>
				</div>
				<!-- /.col-lg-12 -->
			</div>
			<!-- /.row -->
			<div class="panel panel-default">
				<div class="panel-body">
					<form class="form-inline"
						action="<%=basePath%>queryMissionOrderList.action" method="post">
						<div class="form-group">
							<label for="productName">商品名称</label> <input type="text"
								class="form-control" id="gname" value="${q_pojo.gname }"
								name="gname" />
						</div>
						<div class="form-group">
							<label for="customerName">成品名称</label> <input type="text"
								class="form-control" id="pname" value="${q_pojo.pname}"
								name="pname" />
						</div>
						<div class="form-group">
							<fieldset>

								<div class="controls input-append date form_date" data-date=""
									data-date-format="yyyy MM dd" data-link-field="dtp_input1"
									data-link-format="yyyy-mm-dd">
									从&nbsp;&nbsp;<input size="15" type="text"
										value="${q_pojo.dateStart}" id="dateStart" /> <span
										class="add-on"><i class="icon-remove"></i></span> <span
										class="add-on"><i class="icon-th"></i></span>
								</div>
								<input type="hidden" id="dtp_input1" name="dateStart"
									value="${q_pojo.dateStart}" />

								<div class="controls input-append date form_date" data-date=""
									data-date-format="yyyy MM dd" data-link-field="dtp_input2"
									data-link-format="yyyy-mm-dd">
									至&nbsp;&nbsp;<input size="15" type="text"
										value="${q_pojo.dateEnd}" id="dateEnd" /> <span
										class="add-on"><i class="icon-remove"></i></span> <span
										class="add-on"><i class="icon-th"></i></span>
								</div>
								<input type="hidden" id="dtp_input2" name="dateEnd"
									value="${q_pojo.dateEnd}" />
							</fieldset>
						</div>
						<div class="form-group">
							<label for="grammage">克重</label> <input type="text"
								class="form-control" id="grammage" value="${q_pojo.grammage}"
								name="grammage" />
						</div>
						<div class="form-group">
							<label for="specification">规格</label> <input type="text"
								class="form-control" id="specification" value="${q_pojo.specification}"
								name="specification" /> 
						</div>
						<div class="form-group">
							<label for="custLevel">送货地址</label> <input type="text"
								class="form-control" id="address" value="${q_pojo.address}"
								name="address" />
						</div>
						<div class="form-group">
							<label for="custLevel">完成状态</label> <select class="form-control"
								id="isfinish" name="isfinish">
								<option value="">--请选择--</option>
								<option value="yes"
									<c:if test="${q_pojo.isfinish=='yes'}"> selected</c:if>>已完成</option>
								<option value="no"
									<c:if test="${q_pojo.isfinish=='no'}"> selected</c:if>>未完成</option>

							</select>
						</div>

						<button type="submit" class="btn btn-primary">查询</button>
					</form>
				</div>
			</div>
			<div class="row">
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">客户信息列表</div>
						<!-- /.panel-heading -->
						<div class="table-responsive">
							<table class="table table-bordered table-striped">
								<thead>
									<tr>
										<th>操作</th>
										<th>单号</th>
										<th>建表日期</th>
										<th>建表时间</th>
										<th>商品名称</th>
										<th>规格</th>
										<th>克重</th>
										<th>成品名称</th>
										<th>送货地址</th>
										<th>件数</th>
										<th>张数</th>
										<th>订单重量</th>
										<th>已完成张数</th>
										<th>完成状态</th>
										<th>包含工单</th>
										<th>备注</th>
										<th>下单人员</th>

									</tr>
								</thead>

								<tbody>
									<c:forEach items="${MO_list}" var="m_Order">
										<tr>
											<td><a
												href="<%=basePath%>createWorkOrder.action?m_id=${m_Order.m_id}"
												class="btn btn-warning btn-xs">添加</a>
												<c:if test="${sessionScope.user_login.role=='manager'}">
													<a href="<%=basePath%>editMissionOrder.action?m_id=${m_Order.m_id}" 
													class="btn btn-primary btn-xs">修改</a>
													<a href="#" class="btn btn-danger btn-xs"
														onclick="deleteMissionOrder('${m_Order.m_id}')">删除</a>
												</c:if></td>
											<td>${m_Order.m_id}</td>
											<td>${m_Order.m_date}</td>
											<td>${m_Order.m_time}</td>
											<td>${m_Order.gname}</td>
											<td>${m_Order.specification}</td>
											<td>${m_Order.grammage}</td>
											<td>${m_Order.pname}</td>
											<td>${m_Order.address}</td>
											<td>${m_Order.m_num}</td>
											<td>${m_Order.m_count}</td>
											<td>${m_Order.m_weight}</td>
											<td>${m_Order.worktotalcount}</td>
											<td>${m_Order.isfinish}</td>
											<td>${m_Order.child_count}</td>
											<td>${m_Order.m_remark}</td>
											<td>${m_Order.m_user}</td>

										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
						<!-- /.panel-body -->
					</div>
					<!-- /.panel -->
				</div>
				<!-- /.col-lg-12 -->
			</div>
		</div>
		<!-- /#page-wrapper -->

	</div>

	<!-- /#wrapper -->

	<!-- jQuery -->
	<script src="<%=basePath%>js/jquery.min.js"></script>

	<!-- Bootstrap Core JavaScript -->
	<script src="<%=basePath%>js/bootstrap.min.js"></script>

	<!-- Metis Menu Plugin JavaScript -->
	<script src="<%=basePath%>js/metisMenu.min.js"></script>

	<!-- DataTables JavaScript -->
	<script src="<%=basePath%>js/jquery.dataTables.min.js"></script>
	<script src="<%=basePath%>js/dataTables.bootstrap.min.js"></script>

	<!-- Custom Theme JavaScript -->
	<script src="<%=basePath%>js/sb-admin-2.js"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/jquery-1.8.3.min.js" charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/locales/bootstrap-datetimepicker.zh-CN.js"
		charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/locales/bootstrap-datetimepicker.fr.js"
		charset="UTF-8"></script>
	<script type="text/javascript">
		$('.form_date').datetimepicker({
			language : 'zh-CN',
			weekStart : 1,
			todayBtn : 1,
			autoclose : 1,
			todayHighlight : 1,
			startView : 2,
			minView : 2,
			forceParse : 0
		});
		$('.form_date').datetimepicker({
			format : "dd MM yyyy",
			linkField : "dtp_input2",
			linkFormat : "yyyy-mm-dd"
		});
		
		
		function editMissionOrder(id) {
			$.ajax({
				type:"get",
				url:"<%=basePath%>editMissionOrder.action",
				data:{"id":id},
				success:function(data) {
					
				}
			});
		}
		function updateMissionOrder() {
			$.post("<%=basePath%>updateMissionOrder.action",$("#edit_customer_form").serialize(),function(data){
				alert("客户信息更新成功！");
				window.location.reload();
			});
		}
		
		function deleteMissionOrder(m_id) {
			if(confirm(' 确实要删除该任务吗?')) {
				$.ajax({
					type:"post",
					url:"<%=basePath%>deleteMissionOrder.action",
					data:{"m_id":m_id},
					success:function(data) {
						if(data.trim()=="ok")   
						{  
							alert(" 删除成功 ");
							window.location.reload();
						}
						if(data.trim()=="no"){
							alert("删除失败 ");
						}
					},
					error:function(){
						alert("删除失败 ");
					}
				});	
				
			}
		}
	</script>

</body>

</html>
